/**
 * 
 */
package badugi;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

/**
 * @author aleks
 *
 */
public class RoomTest1 {

	private Room rom;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		//rom = new Room(3,10,2,4);
		//rom.run();
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		rom = null;
	}

	@Ignore
	@Test(expected = RoomException.class)
	public void testException1() throws RoomException {
		Room x = new Room(3,1,2,4);
	}
	
	/**
	 * @author aleks
	 * This method tests pack creating (and prints it on console) and shuffling a pack (and prints it).
	 */	
	@Test
	public void testPack1() throws Exception {
		Pack myPack = new Pack();
		ArrayList<Card> myPackNow = myPack.getPack();
		for (Card item : myPackNow) {
			System.out.println(item.toString() + "\n");
		}
		System.out.println("Let's shuffle the pack");
		myPack.shufflePack();
		myPackNow = myPack.getPack();
		for (Card item : myPackNow) {
			System.out.println(item.toString() + "\n");
		}
		
		Hand myHand = new Hand(myPack.giveMeOneCard(), myPack.giveMeOneCard(), myPack.giveMeOneCard(), myPack.giveMeOneCard());
		System.out.println("-----------------\nMy hand: " + myHand.toString());
		
		//changing cards
		Card oldCard = myHand.giveMeTheCardToThrowOut(0);
		Card newCard = myPack.changeOneCard(oldCard);
		myHand.addNewCardFromTheChange(0, newCard);
		System.out.println("My hand after changing: " + myHand.toString());
		System.out.println("Pack of rejected cards after changing: " + myPack.getPackOfRejectedCards().toString());
		
		for (int i = 0; i < 48; i++) {
			System.out.println("-----------------\nMy hand: " + myHand.toString());
			oldCard = myHand.giveMeTheCardToThrowOut(0);
			newCard = myPack.changeOneCard(oldCard);
			myHand.addNewCardFromTheChange(0, newCard);
			System.out.println("My hand after changing: " + myHand.toString());
			System.out.println("Pack of CARDS after changing: " + myPack.getPack().toString());
			System.out.println("Pack of rejected cards after changing: " + myPack.getPackOfRejectedCards().toString());
			System.out.println("Size of Pack of rejected cards: " + myPack.getPackOfRejectedCards().size());
		}
		
	}

}
